package com.cryptoneedle.center.repository.doris;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.bubbles.engine.data.core.repository.BaseRepository;
import com.cryptoneedle.center.common.entity.doris.DorisTable;
import com.cryptoneedle.center.common.key.TableKey;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>description: Doris-元数据-Table </p>
 *
 * @author CryptoNeedle
 * @date 2025-09-25
 */
@Repository
@DS("pg")
public interface DorisTableRepository extends BaseRepository<DorisTable, TableKey> {

    @Query("FROM DorisTable ORDER BY catalogName, databaseName, tableName")
    List<DorisTable> list();

    @Query("FROM DorisTable WHERE catalogName = :catalogName AND databaseName = :databaseName ORDER BY catalogName, databaseName, tableName")
    List<DorisTable> listByDatabase(String catalogName, String databaseName);
}